using System.Collections.Generic;
using System.Linq;

namespace Mbl.ParameterizedTest.FluentCollectionBuilding.Expectors.EnumerableExpectations
{
    public class ContainsExpectation<TElement> : PredicateExpectation<IEnumerable<TElement>>        
    {
        private readonly TElement _expected;

        public ContainsExpectation(TElement expectedElement)
            : base(actual => actual.Contains(expectedElement))
        {
            _expected = expectedElement;
        }

        protected override string GetErrorMessage(IEnumerable<TElement> actual)
        {
            return $"Expected '{CollectionFormatter.Format(actual)}' to contain '{_expected}'";
        }
    }
}